package com.example.web.sys_role_menu.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.utils.ResultVo;
import com.example.utils.ResultUtils;
//import com.example.api_vue.config.AuthAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.example.web.sys_role_menu.service.IRoleMenuService;
import com.example.web.sys_role_menu.entity.RoleMenu;

import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LS
 * @since 2024-02-21
 */
@Api(tags = "xxx接口")
@RestController
@RequestMapping("//role-menu")
        public class RoleMenuController {
    
@Resource
private IRoleMenuService roleMenuService;

@ApiOperation("新增")
@PostMapping
public ResultVo add(@RequestBody RoleMenu roleMenu) {
    if (roleMenuService.save(roleMenu)) {
        return ResultUtils.success("新增成功!");
    }
    return ResultUtils.error("新增失败!");
}

@ApiOperation("编辑")
@PutMapping
public ResultVo edit(@RequestBody RoleMenu roleMenu) {
    if (roleMenuService.updateById(roleMenu)) {
        return ResultUtils.success("编辑成功!");
    }
    return ResultUtils.error("编辑失败!");
}

@ApiOperation("删除")
@DeleteMapping("/{id}")
public ResultVo delete(@PathVariable Long id) {
    if (roleMenuService.removeById(id)) {
        return ResultUtils.success("删除成功!");
    }
    return ResultUtils.error("删除失败!");
}




                                                                                                                                                                                                                                                                                                            }

